<template>
    <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column prop="taskName" label="任务名称"> </el-table-column>
      <el-table-column prop="createDate" label="创建时间"> </el-table-column>
      <el-table-column prop="onlineDate" label="上线时间"> </el-table-column>
      <el-table-column prop="numSessions" label="场次"> </el-table-column>
      <el-table-column prop="position" label="位置"> </el-table-column>
      <el-table-column prop="giftName" label="礼物名称"> </el-table-column>
      <el-table-column prop="giftPrice" label="礼物价格"> </el-table-column>
      <el-table-column prop="userName" label="操作人"> </el-table-column>
    </el-table>
  </template>

  <script>
    import api from '@/api/kbBox';
    export default {
      data() {
        return {
          typeList:{
            '1':'新手',
            '2':'初级',
            '3':'中级',
            '4':'高级'
          },
          tableData: [
          {
            taskName: '任务名称1',
            createDate:'创建时间11',
            onlineDate:'上线时间',
            numSessions:'场次1',
            position:'位置1',
            giftName:'礼物名称1',
            giftPrice:'礼物价格1',
            userName:'操作人1',
          },]
        }
      },
      created(){
          this.axiosOverlapCirclesQuery()
      },
      methods:{
       axiosOverlapCirclesQuery(){
         this.$axios.post(api.KOI_BLIND_BOX)
         .then(res =>{
           const list = res.options.items;
           console.log(list,'请求成功');
           for(let i = 0;i < list.length;i++){
              let item = list[i]
              //let typeName = ''
              // if(item.type == 1){
              //    typeName = '新手'
              // }
              //。。。
              this.tableData.push({
                taskName:item.taskName,
                createDate:item.insdt,
                onlineDate:item.onlineTime,
                numSessions:this.typeList[item.type],
                position:item.positionId,
                giftName:item.propName,
                giftPrice:item.price,
                userName:item.lastAdminName
              })
           }
         })
         .catch(err =>{
           console.log(err,'请求失败')
         })
       }
      }
    }
  </script>